﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Service.BAL;

namespace Service.DAL
{
    public class Kho_DAL
    {
        public void InsetStore(Kho_BAL kho)
        {
            Common_DAL.StoreData.InsertStore(kho.MAKHO, kho.TENKHO);
            Common_DAL.StoreData.SubmitChanges();
        }
        public void EditStore(Kho_BAL edit)
        {
            Common_DAL.StoreData.EditStore(edit.MAKHO,edit.TENKHO);
            Common_DAL.StoreData.SubmitChanges();
        }
        public static List<Kho_BAL> GetAll()
        {
            List<Kho_BAL> list = new List<Kho_BAL>();
            try
            {
                var liststore = from a in Common_DAL.StoreData.Khos
                                select new Kho_BAL
                                {
                                    MAKHO = a.MaKho.Trim(),
                                    TENKHO = a.TenKho.Trim()

                                };
                list = liststore.ToList<Kho_BAL>();
            }
            catch (Exception)
            {
                
                throw;
            }
            return list;
        }
    }
}
